package net.apexes.demo.codegen.dslite.qvar;

import net.apexes.demo.codegen.dslite.entity.AuthUser;
import net.apexes.demo.codegen.dslite.qvar.base.QEntityBase;
import net.wafo.dslite.core.info.Index;

import net.wafo.dslite.core.dsl.*;

/**
 * QAuthUser is a DSLite query type for AuthUser
 * @see AuthUser
 */
public class QAuthUser extends QEntityBase<AuthUser> {

    public static final QAuthUser $ = new QAuthUser("AUTH_USER");

    public final StringColumn username = varchar("USERNAME", 16).field("username").notNull().build();

    public final StringColumn password = varchar("PASSWORD", 32).field("password").notNull().build();

    public final StringColumn nikeName = varchar("NIKE_NAME", 32).field("nikeName").build();

    public final StringColumn email = varchar("EMAIL", 48).field("email").build();

    public final StringColumn mobileNumber = varchar("MOBILE_NUMBER", 16).field("mobileNumber").build();

    public class Indexs {

        public final Index primaryKeyF = index("PRIMARY_KEY_F").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QAuthUser(String tableName) {
        super(AuthUser.class, tableName);
    }

    @Override
    public AuthUser newEntity() {
        return new AuthUser();
    }

    @Override
    public Object getFieldValue(AuthUser entity, String fieldName) {
        switch (fieldName) {
            case "username":
                return entity.getUsername();
            case "password":
                return entity.getPassword();
            case "nikeName":
                return entity.getNikeName();
            case "email":
                return entity.getEmail();
            case "mobileNumber":
                return entity.getMobileNumber();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(AuthUser entity, String fieldName, Object value) {
        switch (fieldName) {
            case "username":
                entity.setUsername((java.lang.String) value);
                break;
            case "password":
                entity.setPassword((java.lang.String) value);
                break;
            case "nikeName":
                entity.setNikeName((java.lang.String) value);
                break;
            case "email":
                entity.setEmail((java.lang.String) value);
                break;
            case "mobileNumber":
                entity.setMobileNumber((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

